home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Developer Essentials / DTS Sample Code / Snippets / Platforms & Tools / MacApp / MouseInfo 1.0 / UMouseInfo.cp < prev    next >
Encoding:
Text File  |  1992-04-29  |  1.8 KB  |  81 lines  |  [TEXT/MPS ]

  1. //     UMouseInfo.cp 
  2. //     Copyright © 1992 by Apple Computer, Inc. All rights reserved.
  3. //    Kent Sandvik DTS
  4. //    This file contains the basic TMapApplication member functions
  5. //    Version Info (latest first):
  6. //
  7. //    <1>        khs        1.0        First final version
  8.  
  9.  
  10. // INCLUDES 
  11.  
  12. #ifndef __MOUSEINFO__
  13. #include "UMouseInfo.h"                                        // class definitions
  14. #endif
  15.  
  16.  
  17. //    Empty constructor - for avoiding ptabs in global data space
  18. #pragma segment ARes
  19. TMapApplication::TMapApplication()
  20. {
  21. }
  22.  
  23.  
  24. //    Initialize the Application object
  25. #pragma segment AInit
  26. pascal void TMapApplication::IMapApplication(OSType fileType,
  27.                                              OSType creator)
  28. {
  29.     inherited::IApplication(fileType, creator);
  30.  
  31.     if (gDeadStripSuppression)
  32.         macroDontDeadStrip(TAppFrameAdorner);
  33.  
  34.     RegisterStdType("TAppFrameAdorner", 'afra');// register adorner types
  35. }
  36.  
  37.  
  38. //    Create a new TDocument from the class
  39. #pragma segment AOpen
  40. pascal TDocument* TMapApplication::DoMakeDocument(CommandNumber/* itsCmdNumber */,
  41.                                                   TFile*/* itsFile */ )
  42. {
  43.     TMouseDocument * aMouseDocument = new TMouseDocument;
  44.     aMouseDocument->IMouseDocument();
  45.     return aMouseDocument;
  46. }
  47.  
  48.  
  49. // Show our cute About Box with Jeff trying to destroy my portable at Bahia Honda
  50. #pragma segment AMain
  51. pascal void TMapApplication::DoAboutBox()
  52. {
  53.     CreateAboutBox();
  54. }
  55.  
  56.  
  57. //    Make sleep region small so we will get more mouse events, make this
  58. //    dynamic so we could turn this on off depending if the mouse tracking behavior is active
  59. #pragma segment MAApplicationRes
  60. pascal RgnHandle TMapApplication::GetSleepRegion()
  61. {
  62.     if (gMouseTrackWindow)                        // we have a floating window tracking mouse movements -> more events needed
  63.     {
  64.         CPoint mousePoint;
  65.         RgnHandle tempRgn = MakeNewRgn();
  66.  
  67.         GetMouse(mousePoint);
  68.         SetRectRgn(tempRgn, mousePoint.v, mousePoint.h, mousePoint.v + 1, mousePoint.h + 1);
  69.  
  70.         return tempRgn;
  71.     }
  72.     else
  73.         return inherited::GetSleepRegion();
  74. }
  75.  
  76.  
  77.  
  78.  
  79.  
  80.  
  81.